Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Background job



  How big is sizeof structure?

First let's see the codes of a structure: struct node{ int a; int b; }; Question : What's sizeof(node)? The answer is very simple, on a 32 bit machine, an int will take 4 bytes and two ints will take 8 bytes. So sizeof(node) is 8. The answer for the above codes is 8, then how about the following structure: struct node{ char a; int b; }; Question : Then what's sizeof(node) now? int takes 4 bytes, char takes 1 bytes, is the answer 5? Now the answer may not be 5, on some mac...

   Data structure alignment, pack     2012-10-29 12:13:37

  SOME LESSONS LEARNED

Note: Google was kind enough to invite me to give a short talk at their Zeitgeist conference earlier this week. It was a really interesting conference and I got a chance to meet a lot of people I admire. For my talk, I decided to use material from some of my blog posts over the years that I thought might appeal to a broader audience. Unfortunately, I was still recovering from a nastly cold/flu so I didn’t deliver the talk as well as I’d like.  Below is the text.Today, I wanted...

   Investor,Startup,Lesson,Experience,Investment     2011-10-12 11:47:02

  Significance and use of do{...}while(0)

In some Linux kernel and other open source codes, we can see some codes like below: do{ ... }while(0) This code snippet is not a loop, it seems there is no significance of using do...while this way, then why should we use it? In fact, the significance of do{...}while(0) is better than optimizing your code. After some research, we summarize some benefits of it. 1. Help define complex macro to avoid error #define DOSOMETHING()\ foo1();\ foo2(); The me...

   do{...}while(0), optimization     2012-10-21 21:13:22

  Command Line Arguments

Our Hello program still isn’t very general. We can’t change the name we say hello to without editing and recompiling the source code. This may be fine for the programmers, but what if the secretaries want their computers to say Hello to them? (I know. This is a little far-fetched but bear with me. I’m making a point.)What we need is a way to change the name at runtime rather than at compile time. (Runtime is when we type java HelloRusty. Compile time is when w...

   Java,Command line arguments,First elemen     2011-09-30 11:31:54

  Great code is written twice (or more)

The last couple of years more and more people have been moving towards Agile development. These techniques aren’t new, most we’re devised in the 80s or 90s. But finally these days programmers and (more importantly) business consultants, architects and clients have learned to love and embrace Agile development.Evolving requirementsIt has now become common knowledge that you can’t write down all the requirements before you start the project. These requirements h...

   Twice,Good code,Recoding,Agile,Evolvement     2011-11-01 00:36:35

  Web Design is 95% Typography

95% of the information on the web is written language. It is only logical to say that a web designer should get good training in the main discipline of shaping written information, in other words: Typography.Information design is typographyBack in 1969, Emil Ruder, a famous Swiss typographer, wrote on behalf of his contemporary print materials what we could easily say about our contemporary websites:Today we are inundated with such an immense flood of printed matter that the value of the individ...

   Web,Typography,Font,Resolution     2011-08-19 08:20:05

  Lossless and Transparency Encoding in WebP

In September 2010 we announced the WebP image format with lossy compression. WebP was proposed as an alternative to JPEG, with 25–34% better compression compared to JPEG images at equivalent SSIM index. We received lots of feedback, and have been busy improving the format.Last month we announced WebP support for animation, ICC profile, XMP metadata and tiling. Today, we introduce a new mode in WebP to compress images losslessly, and support for transparency â€â...

   Google,WebP,Image,Compress, Lossless compression,Transparency     2011-11-18 08:48:33

  Reproduce "MySQL server has gone away" in PHP

If you want to debug the issue of "MySQL server has gone away", you can reproduce it with below steps: Modify configuration file: sudo vi /etc/mysql/my.cnf  Make below changes: [mysqld]   wait_timeout = 30   interactive_timeout = 30  Restart the service: sudo /etc/init.d/mysql restart  Write below PHP codes: $link = mysql_connect('127.0.0.1', 'root', 'root');   if (!$link)&nbs...

   MySQL,debug,rMySQL server has gone away     2013-04-15 11:33:14

  Java code to retrieve Bing background image path

When Microsoft presented their search engine Bing, this new design gave us some surprise, especially its background images, they are very beautiful and it will change every day. But   unfortunately we cannot save the image onto our PC by right clicking the mouse.  After some research on its source code, I found a feasible but not so sophisticated way to achieve this, we can retrieve the image path from the source code and then use this path we can download the image. This is just to sh...

   Java,Bing,Background image path,URL,Download,Save     2012-05-02 10:51:51

  How to tell if this idea is a good idea.

Good Idea or Bad Idea?I’ve got an idea for a product. I’ve talked to some people. I know some people in the industry. I have been cold calling others. The idea is promising. The price point people have agreed with is about where I would like it to be. I’ve shown some mockups around and iterated on them. Now, I feel the need to start writing code because, well, I like writing code. And I’m comfortable writing code.But I see lean people.Steve Blank, Eric ...

   Idea,Good,Bad,Distinguish,Feature,Coding     2011-11-24 09:19:01